Prefer logic on the SupSub node rather than separate logic on SubscriptCommand and SuperscriptCommand #327
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Mathquill had separate
SubscriptCommandandSuperscriptCommandnode classes, which were subclasses ofSupSub.Before this PR, it was possible to create a
SuperscriptCommandthat only contained a subscript with the following steps:x^2x_1^2x_1.(The reverse is possible as well; you could make
x^2be aSubscriptCommandby switching superscript and subscript in the steps).This caused an issue when you typed
)after the resultingx_1because it duplicated the subscript to the superscript, givingx_1^1. (presumably infinalizeTree). A simple fix for that would be to do change the prototype to aSubscriptCommand, but instead this PR removes theSuperscriptCommandandSubscriptCommandclasses in favor of using thesupsubproperty on theSupSubclass.While merging the
SuperscriptCommandandSubscriptCommandmethods intoSupSub, I found and fixed a couple more problems:undefinedshow up for a SupSub with both a superscript and a subscript. E.g. forx_1^yit said"x" Subscript, 1 , Baseline "y" undefined. Now, it says"x" Subscript, 1 , Baseline Superscript, "y" , Baseline.x_1^2it could say"x" squared, forgetting the subscript.SuperscriptCommand, i.e. you typed the superscript first before the subscript.